/*
    
    @预加载文件

*/



var bgImg=new Image();
var heroImg=new Image();
var bltImg=new Image();
var enemyImg1=new Image();
var enemyImg2=new Image();
var enemyImg3=new Image();
var rewardImg=new Image();
var boomImg=new Image();

var imgs=[bgImg,heroImg,bltImg,enemyImg1,enemyImg2,enemyImg3,rewardImg,boomImg];
var srcs=["img/background.png","img/herofly.png","img/bullet1.png","img/enemy1.png","img/enemy2.png","img/enemy3.png","img/prop.png","img/bomb.png"]
//用来记录加载完的数量
var loadedNum=0;
//预加载
function loading(callBack){
    for(var i=0;i<imgs.length;i++){
        imgs[i].onload=function(){
            loadedNum++;
            if(loadedNum==imgs.length){
                //回调
                callBack();
            }
        }
        imgs[i].src=srcs[i]
    }
}





